# 折线
# import matplotlib.pyplot as plt
# fig = plt.figure(2)
# plt1 = fig.add_subplot(1, 2, 1)
# plt2 = fig.add_subplot(1, 2, 2)
# x = [100, 200, 150]
# y = [100, 200, 300]
# y2 = [100, 100, 300]
# plt1.plot(x, y)
# plt2.plot(x,y2)
# plt.show()


# 三角函数
# import matplotlib.pyplot as plt
# import numpy as np

# i = np.arange(0.0, 2 * np.pi, 0.01)
# plt.plot(np.sin(i * 2) * np.cos(i * 1), np.sin(i * 3) * np.cos(2 * i))
# plt.axis('off')
# plt.xticks([])
# plt.yticks([])
# plt.show()

import matplotlib.pyplot as plt
import numpy as np
def squiggle_xy(a, b, c, d, i=np.arange(0.0, 2*np.pi, 0.05)):
    return np.sin(i*a)*np.cos(i*b), np.sin(i*c)*np.cos(i*d)


fig11 = plt.figure(figsize=(8, 8), constrained_layout=False)
outer_grid = fig11.add_gridspec(4, 4, wspace=0, hspace=0)

for a in range(4):
    for b in range(4):
        # gridspec inside gridspec
        inner_grid = outer_grid[a, b].subgridspec(3, 3, wspace=0, hspace=0)
        axs = inner_grid.subplots()  # Create all subplots for the inner grid.
        for (c, d), ax in np.ndenumerate(axs):
            ax.plot(*squiggle_xy(a + 1, b + 1, c + 1, d + 1))
            ax.set(xticks=[], yticks=[])

# show only the outside spines
for ax in fig11.get_axes():
    ax.spines['top'].set_visible(ax.is_first_row())
    ax.spines['bottom'].set_visible(ax.is_last_row())
    ax.spines['left'].set_visible(ax.is_first_col())
    ax.spines['right'].set_visible(ax.is_last_col())

plt.show()



# import numpy as np
# import matplotlib.pyplot as plt
# from scipy.integrate import odeint

# def diff(y, x):
# 	return np.array(-x)
# 	# 上面定义的函数在odeint里面体现的就是dy/dx = x
# x = np.linspace(-10, 10, 100)  # 给出x范围
# # y = odeint(diff, 0, x)  # 设初值为0 此时y为一个数组，元素为不同x对应的y值
# # 也可以直接
# y = odeint(lambda y, x: -x, 0, x)
# plt.plot(x, y[:, 0])  # y数组（矩阵）的第一列，（因为维度相同，plt.plot(x, y)效果相同）
# plt.grid()
# plt.show()

#fresnel
# import numpy as np
# from scipy.special import fresnel
# import matplotlib.pyplot as plt
# plt.figure(figsize=(10, 10)) 
# t = np.linspace(-10, 10, 1000)
# plt.plot(*fresnel(t), c='r')
# plt.show()


# from scipy.special import fresnel
# from scipy import linspace
# import matplotlib.pyplot as plt
# t = linspace(-10, 10, 1000)
# FS, FC = fresnel(t)
# fig1=plt.figure(figsize=(12,5))
# ax1=plt.subplot(1, 2, 1)
# ax1.plot(FC, FS, linewidth=1)
# ax1.set_xlabel("C(t)", fontsize=14, weight='bold')
# ax1.set_ylabel("S(t)", fontsize=14, weight='bold')
# ax1.set_title("Cornu spiral", fontsize=16, weight='bold')

# ax2=plt.subplot(1, 2, 2)
# ax2.plot(t, FS, ls='--',linewidth=1,label="S(t)", alpha=.8)
# ax2.plot(t, FC,ls='-',linewidth=1,label="C(t)", alpha=.8)
# ax2.set_xlabel("t", fontsize=14, weight='bold')
# ax2.set_title("Fresnel integrals", fontsize=16, weight='bold')
# plt.legend()
# plt.show()